/*
 * Copyright (C) 2018 Logos Technology Ltd.
 */

package com.logos.common.source.network.callback;

import com.logos.common.source.network.entity.FailedNetEntity;

import okhttp3.Request;
import okhttp3.Response;

/**
 * @author Young Ken
 */

public abstract class HttpRespondResultCallBack<T> {

    private Response mResponse;
    private Request mRequest;

    public HttpRespondResultCallBack() {

    }

    public Response getResponse() {
        return mResponse;
    }

    public void setResponse(Response response) {
        mResponse = response;
    }

    public Request getRequest() {
        return mRequest;
    }

    public void setRequest(Request request) {
        mRequest = request;
    }

    /**
     * before
     */
    public abstract void onBefore();

    /**
     * after
     */
    public abstract void onAfter();

    /**
     * success
     *
     * @param result T
     */
    public abstract void onSuccess(T result);

    /**
     * fail
     *
     * @param error  Throwable
     * @param entity BaseNetEntity
     */
    public abstract void onFailure(Throwable error, FailedNetEntity entity);
}
